﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace NJL.WebUsers.AdminEnterprise
{
    public partial class Default :BasePage
    {
        NJL.BLL.NJL_COMPANY_SERVICE bllCompanyService = new BLL.NJL_COMPANY_SERVICE();
        NJL.BLL.NJL_MYFRIEND bllFriend = new BLL.NJL_MYFRIEND();
        NJL.BLL.NJL_MY_COLLECTION bllColection = new BLL.NJL_MY_COLLECTION();
        NJL.BLL.NJL_COMPANY bllCompany = new BLL.NJL_COMPANY();
        NJL.BLL.NJL_NEWS bllNews = new BLL.NJL_NEWS();
        NJL.Model.NJL_COMPANY modelCompany;
        protected void Page_Load(object sender, EventArgs e)
        {
     
            modelCompany = bllCompany.GetCompanyByUserIDModel(UserId);
            if (modelCompany != null)
            {
               DataSet ds = bllCompanyService.GetList("NJL_COMPANY_ID='" + modelCompany.ID+"'");
               litServiceCount.Text = ds.Tables[0].Rows.Count.ToString();               
            }
            if (!IsPostBack)
            {
                Page.Title = modelCompany.COMPANY_NAME + "的用户中心";
                #region 游客分享
                DataSet ds = bllNews.GetList(9, "NJL_SYS_BASE_ID='" + WEBSITE_CODE + "'", "VISIT_COUNT desc");
                rptShare.DataSource = ds;
                rptShare.DataBind();
                #endregion
                #region 活跃游客
                NJL.BLL.NJL_PERSON bllPerson = new BLL.NJL_PERSON();
                ds = bllPerson.GetList(4, "a.NJL_SYS_BASE_ID='"+WEBSITE_CODE+"'", "a.VISIT_COUNT desc");
                rptUser.DataSource = ds;
                rptUser.DataBind();
                #endregion
                #region 咨询
                NJL.BLL.NJL_SYS_NEWS bllSysNews = new BLL.NJL_SYS_NEWS();
                ds = bllSysNews.GetList(9, "NJL_SYS_BASE_ID='" + WEBSITE_CODE + "' and TYPE_CODE='31' and IS_PUBLISH=1", "PUBLISH_DATE_TIME desc");
                rptNews.DataSource = ds;
                rptNews.DataBind();
                #endregion
            }
        }

    }
}